-------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  /Users/Wei/Dropbox/Fertility/Results/cfps_results.log
  log type:  text
 opened on:  21 Apr 2020, 00:02:27

. /*
> cd "$path1/fulllaunch10"
> unicode encoding set gb18030
> unicode translate cfps2010adult_report.dta, invalid
> unicode translate cfps2010family_report.dta, invalid
> */
. gl CONTROL_1 = "women#prov##c.year_birth women#year_birth#year" 

. gl CONTROL_2 = "women#prov##c.year_birth women#year_birth#year prov#year" 

. 
. gl FINE_ALL = "fine_6_15 fine_16_20"

. gl FINE_VAR_1 = "fine_6_20"

. 
. 
. use "$path2/CFPS_OCP", clear 

. 
. keep if !mi(happy) | !mi(sat_marr)
(26,115 observations deleted)

. 
. * Table 1 Panel C
. su age senior happiness sat_marr sat_duty_other agree_women_marr agree_women_chid if women & !m
> i(happy)

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
         age |     23,482    50.04046    10.66986         30         74
      senior |     22,114    .1422176    .3492811          0          1
   happiness |     23,482    7.553019     2.17295          0         10
    sat_marr |      9,799    .8335544    .3724991          0          1
sat_duty_o~r |     10,901    .6252637    .4840769          0          1
-------------+---------------------------------------------------------
agree_wome~r |     10,901    .6248968    .4841718          0          1
agree_wome~d |     10,901    .8258875    .3792236          0          1

. su age senior happiness sat_marr sat_duty_other agree_women_marr agree_women_chid if men & !mi(
> happy)

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
         age |     22,583    50.51778    10.83588         30         74
      senior |     20,685    .2086053    .4063214          0          1
   happiness |     22,583    7.456317    2.129796          0         10
    sat_marr |      9,801    .8933782    .3086475          0          1
sat_duty_o~r |     10,655    .8027217    .3979628          0          1
-------------+---------------------------------------------------------
agree_wome~r |     10,655    .5390896    .4984931          0          1
agree_wome~d |     10,655    .7419991    .4375551          0          1

. 
. 
. cap erase "$path3/tab_6.xls"

. cap erase "$path3/tab_6.txt"

. 
. foreach CONTROL in "$CONTROL_1"{
  2. foreach y_var in  "happiness" "sat_marr"  "sat_duty_other" "agree_women_marr"  "agree_women_
> chid"{ 
  3. 
. reghdfe `y_var' women#c.($FINE_VAR_1) , a(`CONTROL') cluster(prov)
  4. su `y_var' if women 
  5. local mean_women = `r(mean)'
  6. su `y_var' if men 
  7. local mean_men = `r(mean)'
  8. test  (1.women#c.$FINE_VAR_1 = 0.women#c.$FINE_VAR_1) 
  9. local F_gender = `r(F)'
 10. local p_gender = `r(p)'
 11. outreg2 using "$path3/tab_6.xls", append dec(3) adds(mean-men, `mean_men',  mean-women,`mean
> _women', F-stat, `F_gender', p-value, `p_gender')
 12. 
. 
. }
 13. 
. 
. }
(dropped 1 singleton observations)
(MWFE estimator converged in 5 iterations)

HDFE Linear regression                            Number of obs   =     46,064
Absorbing 2 HDFE groups                           F(   2,     29) =       3.97
Statistics robust to heteroskedasticity           Prob > F        =     0.0300
                                                  R-squared       =     0.0402
                                                  Adj R-squared   =     0.0343
                                                  Within R-sq.    =     0.0001
Number of clusters (prov)    =         30         Root MSE        =     2.1152

                                       (Std. Err. adjusted for 30 clusters in prov)
-----------------------------------------------------------------------------------
                  |               Robust
        happiness |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
------------------+----------------------------------------------------------------
women#c.fine_6_20 |
               0  |  -.1034271   .1134027    -0.91   0.369    -.3353616    .1285074
               1  |   .2084096   .0968817     2.15   0.040     .0102643    .4065549
                  |
            _cons |   7.475499   .0454104   164.62   0.000     7.382624    7.568374
-----------------------------------------------------------------------------------

Absorbed degrees of freedom:
-------------------------------------------------------------------+
               Absorbed FE | Categories  - Redundant  = Num. Coefs |
---------------------------+---------------------------------------|
                women#prov |        59          59           0    *|
   women#prov#c.year_birth |        59           0          59     |
     women#year_birth#year |       164           0         164    ?|
-------------------------------------------------------------------+
? = number of redundant parameters may be higher
* = FE nested within cluster; treated as redundant for DoF computation

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
   happiness |     23,482    7.553019     2.17295          0         10

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
   happiness |     22,583    7.456317    2.129796          0         10

 ( 1)  - 0b.women#c.fine_6_20 + 1.women#c.fine_6_20 = 0

       F(  1,    29) =    6.82
            Prob > F =    0.0141
/Users/Wei/Dropbox/Fertility/Results/tab_6.xls
dir : seeout
(dropped 1 singleton observations)
(MWFE estimator converged in 6 iterations)

HDFE Linear regression                            Number of obs   =     19,628
Absorbing 2 HDFE groups                           F(   2,     29) =       2.24
Statistics robust to heteroskedasticity           Prob > F        =     0.1242
                                                  R-squared       =     0.0315
                                                  Adj R-squared   =     0.0216
                                                  Within R-sq.    =     0.0001
Number of clusters (prov)    =         30         Root MSE        =     0.3399

                                       (Std. Err. adjusted for 30 clusters in prov)
-----------------------------------------------------------------------------------
                  |               Robust
         sat_marr |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
------------------+----------------------------------------------------------------
women#c.fine_6_20 |
               0  |  -.0076086   .0178577    -0.43   0.673    -.0441317    .0289144
               1  |   .0295496   .0167094     1.77   0.088    -.0046249    .0637241
                  |
            _cons |   .8569301    .007857   109.07   0.000     .8408607    .8729996
-----------------------------------------------------------------------------------

Absorbed degrees of freedom:
-------------------------------------------------------------------+
               Absorbed FE | Categories  - Redundant  = Num. Coefs |
---------------------------+---------------------------------------|
                women#prov |        58          58           0    *|
   women#prov#c.year_birth |        58           0          58     |
     women#year_birth#year |        82           0          82    ?|
-------------------------------------------------------------------+
? = number of redundant parameters may be higher
* = FE nested within cluster; treated as redundant for DoF computation

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
    sat_marr |      9,820    .8335031    .3725451          0          1

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
    sat_marr |      9,809    .8930574     .309056          0          1

 ( 1)  - 0b.women#c.fine_6_20 + 1.women#c.fine_6_20 = 0

       F(  1,    29) =    3.67
            Prob > F =    0.0654
/Users/Wei/Dropbox/Fertility/Results/tab_6.xls
dir : seeout
(dropped 1 singleton observations)
(MWFE estimator converged in 5 iterations)

HDFE Linear regression                            Number of obs   =     21,584
Absorbing 2 HDFE groups                           F(   2,     29) =       2.53
Statistics robust to heteroskedasticity           Prob > F        =     0.0972
                                                  R-squared       =     0.0642
                                                  Adj R-squared   =     0.0555
                                                  Within R-sq.    =     0.0002
Number of clusters (prov)    =         30         Root MSE        =     0.4397

                                       (Std. Err. adjusted for 30 clusters in prov)
-----------------------------------------------------------------------------------
                  |               Robust
   sat_duty_other |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
------------------+----------------------------------------------------------------
women#c.fine_6_20 |
               0  |  -.0344197   .0266315    -1.29   0.206    -.0888873    .0200479
               1  |   .0558174   .0323912     1.72   0.095    -.0104301    .1220649
                  |
            _cons |   .7069023   .0116584    60.63   0.000     .6830581    .7307464
-----------------------------------------------------------------------------------

Absorbed degrees of freedom:
-------------------------------------------------------------------+
               Absorbed FE | Categories  - Redundant  = Num. Coefs |
---------------------------+---------------------------------------|
                women#prov |        58          58           0    *|
   women#prov#c.year_birth |        58           0          58     |
     women#year_birth#year |        82           0          82    ?|
-------------------------------------------------------------------+
? = number of redundant parameters may be higher
* = FE nested within cluster; treated as redundant for DoF computation

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
sat_duty_o~r |     10,922    .6253433    .4840563          0          1

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
sat_duty_o~r |     10,663    .8024946    .3981355          0          1

 ( 1)  - 0b.women#c.fine_6_20 + 1.women#c.fine_6_20 = 0

       F(  1,    29) =    5.06
            Prob > F =    0.0323
/Users/Wei/Dropbox/Fertility/Results/tab_6.xls
dir : seeout
(dropped 1 singleton observations)
(MWFE estimator converged in 5 iterations)

HDFE Linear regression                            Number of obs   =     21,584
Absorbing 2 HDFE groups                           F(   2,     29) =       2.09
Statistics robust to heteroskedasticity           Prob > F        =     0.1424
                                                  R-squared       =     0.0375
                                                  Adj R-squared   =     0.0285
                                                  Within R-sq.    =     0.0002
Number of clusters (prov)    =         30         Root MSE        =     0.4861

                                       (Std. Err. adjusted for 30 clusters in prov)
-----------------------------------------------------------------------------------
                  |               Robust
 agree_women_marr |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
------------------+----------------------------------------------------------------
women#c.fine_6_20 |
               0  |  -.0321415   .0277505    -1.16   0.256    -.0888976    .0246146
               1  |  -.0581219    .028549    -2.04   0.051    -.1165112    .0002675
                  |
            _cons |   .6066479   .0129852    46.72   0.000     .5800902    .6332057
-----------------------------------------------------------------------------------

Absorbed degrees of freedom:
-------------------------------------------------------------------+
               Absorbed FE | Categories  - Redundant  = Num. Coefs |
---------------------------+---------------------------------------|
                women#prov |        58          58           0    *|
   women#prov#c.year_birth |        58           0          58     |
     women#year_birth#year |        82           0          82    ?|
-------------------------------------------------------------------+
? = number of redundant parameters may be higher
* = FE nested within cluster; treated as redundant for DoF computation

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
agree_wome~r |     10,922    .6249771     .484151          0          1

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
agree_wome~r |     10,663    .5390603    .4984953          0          1

 ( 1)  - 0b.women#c.fine_6_20 + 1.women#c.fine_6_20 = 0

       F(  1,    29) =    0.85
            Prob > F =    0.3649
/Users/Wei/Dropbox/Fertility/Results/tab_6.xls
dir : seeout
(dropped 1 singleton observations)
(MWFE estimator converged in 5 iterations)

HDFE Linear regression                            Number of obs   =     21,584
Absorbing 2 HDFE groups                           F(   2,     29) =       3.46
Statistics robust to heteroskedasticity           Prob > F        =     0.0451
                                                  R-squared       =     0.0340
                                                  Adj R-squared   =     0.0250
                                                  Within R-sq.    =     0.0002
Number of clusters (prov)    =         30         Root MSE        =     0.4062

                                       (Std. Err. adjusted for 30 clusters in prov)
-----------------------------------------------------------------------------------
                  |               Robust
 agree_women_chid |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
------------------+----------------------------------------------------------------
women#c.fine_6_20 |
               0  |  -.0285848   .0232148    -1.23   0.228    -.0760644    .0188947
               1  |  -.0442411   .0212173    -2.09   0.046    -.0876355   -.0008468
                  |
            _cons |   .8037389   .0076442   105.14   0.000     .7881048     .819373
-----------------------------------------------------------------------------------

Absorbed degrees of freedom:
-------------------------------------------------------------------+
               Absorbed FE | Categories  - Redundant  = Num. Coefs |
---------------------------+---------------------------------------|
                women#prov |        58          58           0    *|
   women#prov#c.year_birth |        58           0          58     |
     women#year_birth#year |        82           0          82    ?|
-------------------------------------------------------------------+
? = number of redundant parameters may be higher
* = FE nested within cluster; treated as redundant for DoF computation

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
agree_wome~d |     10,922     .825673    .3794078          0          1

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
agree_wome~d |     10,663    .7419113    .4376036          0          1

 ( 1)  - 0b.women#c.fine_6_20 + 1.women#c.fine_6_20 = 0

       F(  1,    29) =    0.21
            Prob > F =    0.6482
/Users/Wei/Dropbox/Fertility/Results/tab_6.xls
dir : seeout

. 
. 
. use "$path2/CFPS_OCP", clear 

. keep if women == 1 
(35,754 observations deleted)

. keep if year < 2014
(11,879 observations deleted)

. keep if age < 60 & age > 25
(4,865 observations deleted)

. 
. replace age = year - year_birth
(0 real changes made)

. su finc* pce 

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
        finc |     18,306    40719.42    57969.73          0    2086000
    finc_net |     18,173    38509.78    52758.77          1    2042105
finc_net_per |     18,897    10500.81     15128.8         .2     612700
         pce |      8,201    41331.68    46462.62        566    1286982

. 
. replace lnpce = . if lnpce < 7 | lnpce > 13
(0 real changes made)

. replace lnfinc_per = . if lnfinc_per < 5 | lnfinc_per > 13
(0 real changes made)

. replace lnfinc_net_per = . if lnfinc_net_per < 5 | lnfinc_net_per > 13
(0 real changes made)

. gen sav_rate = (finc_net - pce)/finc_net
(12,228 missing values generated)

. drop  if sav_rate < -5
(916 observations deleted)

. 
. gen lnpce_per = lnpce - (lnfinc_net - lnfinc_net_per)
(12,239 missing values generated)

. gl CONTROL_1 = "women#prov##c.year_birth women#year_birth#year" 

. 
. 
. reghdfe senior women#c.($FINE_VAR_1) , a($CONTROL_1) cluster(prov)
(dropped 1 singleton observations)
(MWFE estimator converged in 5 iterations)

HDFE Linear regression                            Number of obs   =     17,641
Absorbing 2 HDFE groups                           F(   1,     28) =       5.74
Statistics robust to heteroskedasticity           Prob > F        =     0.0235
                                                  R-squared       =     0.0940
                                                  Adj R-squared   =     0.0881
                                                  Within R-sq.    =     0.0006
Number of clusters (prov)    =         29         Root MSE        =     0.3561

                                       (Std. Err. adjusted for 29 clusters in prov)
-----------------------------------------------------------------------------------
                  |               Robust
           senior |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
------------------+----------------------------------------------------------------
women#c.fine_6_20 |
               1  |   .0679822   .0283632     2.40   0.023     .0098828    .1260815
                  |
            _cons |   .1226841   .0184409     6.65   0.000     .0849096    .1604585
-----------------------------------------------------------------------------------

Absorbed degrees of freedom:
-------------------------------------------------------------------+
               Absorbed FE | Categories  - Redundant  = Num. Coefs |
---------------------------+---------------------------------------|
                women#prov |        29          29           0    *|
   women#prov#c.year_birth |        29           1          28     |
     women#year_birth#year |        58           0          58    ?|
-------------------------------------------------------------------+
? = number of redundant parameters may be higher
* = FE nested within cluster; treated as redundant for DoF computation

. su senior 

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
      senior |     17,642    .1669312     .372925          0          1

. outreg2 using "$path3/tab_c16.xls",replace dec(3) adds(Mean, `r(mean)')
/Users/Wei/Dropbox/Fertility/Results/tab_c16.xls
dir : seeout

. 
. foreach y_var in  "lnfinc_net_per"{
  2. reghdfe `y_var'  women#c.($FINE_VAR_1), a($CONTROL_1) cluster(prov)
  3. su `y_var'  
  4. outreg2 using "$path3/tab_c16.xls",append dec(3)  adds(Mean, `r(mean)')
  5. reghdfe `y_var'  women#c.($FINE_VAR_1) if !mi(lnpce_per), a($CONTROL_1) cluster(prov)
  6. su `y_var'   if !mi(lnpce_per)
  7. outreg2 using "$path3/tab_c16.xls",append dec(3)  adds(Mean, `r(mean)')
  8. }
(dropped 1 singleton observations)
(MWFE estimator converged in 5 iterations)

HDFE Linear regression                            Number of obs   =     17,924
Absorbing 2 HDFE groups                           F(   1,     28) =       4.95
Statistics robust to heteroskedasticity           Prob > F        =     0.0344
                                                  R-squared       =     0.1761
                                                  Adj R-squared   =     0.1708
                                                  Within R-sq.    =     0.0003
Number of clusters (prov)    =         29         Root MSE        =     0.8888

                                       (Std. Err. adjusted for 29 clusters in prov)
-----------------------------------------------------------------------------------
                  |               Robust
   lnfinc_net_per |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
------------------+----------------------------------------------------------------
women#c.fine_6_20 |
               1  |   .1214122   .0545819     2.22   0.034     .0096062    .2332182
                  |
            _cons |   8.760867    .036241   241.74   0.000     8.686631    8.835103
-----------------------------------------------------------------------------------

Absorbed degrees of freedom:
-------------------------------------------------------------------+
               Absorbed FE | Categories  - Redundant  = Num. Coefs |
---------------------------+---------------------------------------|
                women#prov |        29          29           0    *|
   women#prov#c.year_birth |        29           1          28     |
     women#year_birth#year |        58           0          58    ?|
-------------------------------------------------------------------+
? = number of redundant parameters may be higher
* = FE nested within cluster; treated as redundant for DoF computation

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
lnfinc_net~r |     17,925    8.841525    .9760412   5.007965   12.95039
/Users/Wei/Dropbox/Fertility/Results/tab_c16.xls
dir : seeout
(MWFE estimator converged in 5 iterations)

HDFE Linear regression                            Number of obs   =      6,556
Absorbing 2 HDFE groups                           F(   1,     28) =       4.14
Statistics robust to heteroskedasticity           Prob > F        =     0.0514
                                                  R-squared       =     0.1228
                                                  Adj R-squared   =     0.1113
                                                  Within R-sq.    =     0.0004
Number of clusters (prov)    =         29         Root MSE        =     0.8491

                                       (Std. Err. adjusted for 29 clusters in prov)
-----------------------------------------------------------------------------------
                  |               Robust
   lnfinc_net_per |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
------------------+----------------------------------------------------------------
women#c.fine_6_20 |
               1  |   .1289579   .0633634     2.04   0.051    -.0008362     .258752
                  |
            _cons |   8.983387   .0434268   206.86   0.000     8.894432    9.072343
-----------------------------------------------------------------------------------

Absorbed degrees of freedom:
-------------------------------------------------------------------+
               Absorbed FE | Categories  - Redundant  = Num. Coefs |
---------------------------+---------------------------------------|
                women#prov |        29          29           0    *|
   women#prov#c.year_birth |        29           1          28     |
     women#year_birth#year |        28           0          28    ?|
-------------------------------------------------------------------+
? = number of redundant parameters may be higher
* = FE nested within cluster; treated as redundant for DoF computation

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
lnfinc_net~r |      6,556     9.07177    .9007363    5.01976   12.50791
/Users/Wei/Dropbox/Fertility/Results/tab_c16.xls
dir : seeout

. 
. reghdfe lnpce_per women#c.($FINE_VAR_1) , a($CONTROL_1) cluster(prov)
(MWFE estimator converged in 5 iterations)

HDFE Linear regression                            Number of obs   =      6,556
Absorbing 2 HDFE groups                           F(   1,     28) =       2.94
Statistics robust to heteroskedasticity           Prob > F        =     0.0977
                                                  R-squared       =     0.1079
                                                  Adj R-squared   =     0.0962
                                                  Within R-sq.    =     0.0004
Number of clusters (prov)    =         29         Root MSE        =     0.7731

                                       (Std. Err. adjusted for 29 clusters in prov)
-----------------------------------------------------------------------------------
                  |               Robust
        lnpce_per |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
------------------+----------------------------------------------------------------
women#c.fine_6_20 |
               1  |   .1104757   .0644847     1.71   0.098    -.0216152    .2425667
                  |
            _cons |     8.9177   .0441953   201.78   0.000     8.827171     9.00823
-----------------------------------------------------------------------------------

Absorbed degrees of freedom:
-------------------------------------------------------------------+
               Absorbed FE | Categories  - Redundant  = Num. Coefs |
---------------------------+---------------------------------------|
                women#prov |        29          29           0    *|
   women#prov#c.year_birth |        29           1          28     |
     women#year_birth#year |        28           0          28    ?|
-------------------------------------------------------------------+
? = number of redundant parameters may be higher
* = FE nested within cluster; treated as redundant for DoF computation

. su lnpce_per 

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
   lnpce_per |      6,556    8.993416    .8132025   5.437718   12.00295

. outreg2 using "$path3/tab_c16.xls",append dec(3) adds(Mean, `r(mean)')
/Users/Wei/Dropbox/Fertility/Results/tab_c16.xls
dir : seeout

. 
. log close
      name:  <unnamed>
       log:  /Users/Wei/Dropbox/Fertility/Results/cfps_results.log
  log type:  text
 closed on:  21 Apr 2020, 00:02:30
-------------------------------------------------------------------------------------------------
